package com.xkdx.caipiao.my;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.FragmentManager;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebSettings.LayoutAlgorithm;
import android.webkit.WebSettings.ZoomDensity;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.xkdx.caipiao.R;

public class TouZhuProtocolActivtiy extends Activity {
	private ImageView back;
	WebView webView;
	String www;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.protocol_caipiao);
		findView();
	}

	void findView() {
		back = (ImageView) findViewById(R.id.back);
		www = "file:///android_asset/protocol.html";
		webView = (WebView) findViewById(R.id.webView);
		webView.loadUrl(www);
		webView.setWebChromeClient(new WebChromeClient() {
			public void onProgressChanged(WebView view, int progress) {

			}
		});
		WebSettings setting = webView.getSettings();
		webView.setWebViewClient(new webViewClient());
//		setting.setBuiltInZoomControls(true);
//		setting.setSupportZoom(true);
		// webView设置自适应

		setting.setJavaScriptEnabled(true);


		
		back.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				finish();
			}
		});
	}

	class webViewClient extends WebViewClient {

		// 重写shouldOverrideUrlLoading方法，使点击链接后不使用其他的浏览器打开。

		@Override
		public boolean shouldOverrideUrlLoading(WebView view, String url) {

			view.loadUrl(url);

			// 如果不需要其他对点击链接事件的处理返回true，否则返回false
			return true;

		}
	}

}
